package aos.voting.entity;

import java.io.Serializable;

public class Message implements Serializable {
	private static final long serialVersionUID = 1L;
	private int msgId;
	private int toId;
	private int fromId;
	private MessageType msgType;
	private int objectId;
	private int value;
	private int version;
	private DataSet dataset;

	public Message(MessageType msgType) {
		this(msgType, -1, -1);
	}

	public Message(MessageType msgType, int toId, int fromId) {
		this(msgType, toId, fromId, -1, 0, -1);
	}

	public Message(MessageType msgType, int toId, int fromId, int objectId,
			int value) {
		this(msgType, toId, fromId, objectId, value, -1);
	}

	public Message(MessageType msgType, int toId, int fromId, int objectId,
			int value, int version) {
		setToId(toId);
		setFromId(fromId);
		setMsgType(msgType);
		setObjectId(objectId);
		setValue(value);
		setVersion(version);
	}

	public String toString() {
		return "msgId: " + msgId + " fromId: " + fromId + " toId: " + toId
				+ " msgType: " + msgType + " objectId: " + objectId
				+ " value: " + value + " version: " + version;
	}

	public MessageType getMsgType() {
		return msgType;
	}

	public void setMsgType(MessageType msgType) {
		this.msgType = msgType;
	}

	public int getToId() {
		return toId;
	}

	public void setToId(int toId) {
		this.toId = toId;
	}

	public int getFromId() {
		return fromId;
	}

	public void setFromId(int fromId) {
		this.fromId = fromId;
	}

	public int getObjectId() {
		return objectId;
	}

	public void setObjectId(int objectId) {
		this.objectId = objectId;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public int getMsgId() {
		return msgId;
	}

	public void setMsgId(int msgId) {
		this.msgId = msgId;
	}

	public DataSet getDataset() {
		return dataset;
	}

	public void setDataset(DataSet dataset) {
		this.dataset = dataset;
	}

}
